<?php include_once 'include/header.php'; ?>
<?php include_once 'albumcontroller.php'; ?>
<div id="content">
    <?php include_once 'include/leftsidebar.php' ?>
    <div id="cmiddle" style="width:760px;border-right: none">
        <div id="content-middle">           
            <div style="margin-top:20px">
                <div  style="line-height: 36px;height:36px;border-bottom:1px solid #ccc;margin-top:30px;background: url('Images/icon/album.png') no-repeat 1px center">
                    <b style="font-size: 1.5em;padding-left:30px">Album ảnh lớp 52PM1 (Nhấn vào hình để xem ảnh lớn) - <a class="link" href="upload.php" style="color:#a11818">Upload hình ảnh</a></b>
                </div> 
            </div>     
            <div style="margin: 10px">
                <?php
                    
                    $list_album = get_all_album($page1, "?page=");
                    ?>              
                <?php foreach($list_album as $al){ ?>
                <div style="margin:5px;float:left;position: relative">
                    <?php if($al["user_id"] == $_COOKIE["id"]){ ?>
                    <img class="delete_image" id="<?php echo $al[0] ?>" src="js/fancybox/fancy_close.png" style="position: absolute;top:-8px;right:-8px"/>
                    <?php } ?>
                    <a title="<?php echo "Thành viên upload: ".$al["fullname"] ?>" class="viewalbum" href="data/album/<?php echo $al["image_name"] ?>">
                        <img style="width:128px" height="128px" class="img-border" src="data/album/<?php echo $al["image_name"] ?>" alt="<?php echo $al["image_name"] ?>"/>
                    </a>
                </div>
                
                <?php } ?>
                <div style="clear: both"></div>                
            </div>
            <div class="paging" style="text-align: center;margin-top:10px;height:25px;"><?php echo $page1->firs_page ?><?php echo $page1->previous_page ?><?php echo "$page1->page_links"; ?><?php echo $page1->next_page ?><?php echo $page1->last_page ?></div>
        </div>
    </div>    
</div>
<script type="text/javascript">   
    function saveAct(){         
         var a = new Array();
        $.each($("input[type='radio']:checked"), function(index, item) {
            var id = $(item).attr("value");
            a.push(id);                    
        });
        if(a.length > 0){
            $("#tour-form").submit();          
        }
                      
                
    }
    $(function(){
        $("a.viewalbum").fancybox({
                'opacity'		: true,
                'overlayShow'	: false,
                'transitionIn'	: 'elastic',
                'transitionOut'	: 'none'
        });
        $("#ngaybatdau").datetimepicker({
            showSecond: true,
            timeFormat: 'hh:mm:ss'
        });
        $(".delete_image").click(function(){
            var id = $(this).attr("id");
            if(confirm("Bạn có muốn xóa hình ảnh này?")){
              $.ajax({
               url:"albumcontroller.php?action=delete_image&id="+id,
               type:"GET",
               success:function(data){
                   if(data == true){
                     location.reload();  
                   }                   
               }
           })   
            }           
           return false;
        });
    })
</script>
<?php include_once 'include/footer.php' ?>

